package com.snailhd.redis;

import com.snailhd.cloud.redis.service.RedisService;
import com.snailhd.common.constant.Status;
import com.snailhd.common.util.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Component;

/**
 * @author hd
 * @description
 * @date 2019-11-25 22:41
 */

@Component
public class RedisOperations {

    @Reference
    RedisService redisService;


    public boolean existStockRealTimeIndex(String docName){
        String docNameForRedis = redisService.get(RedisKeys.CONFIG_REAL_TIME_MONGO_INDEX+docName);
        return StringUtils.isNotBlank(docNameForRedis);
    }


    public void saveStockRealTimeIndex(String docName){
        redisService.hset(RedisKeys.CONFIG_REAL_TIME_MONGO_INDEX,docName, Status.YES.toString());
    }

}
